﻿namespace Creek.UI.EFML.Base.EFML.Processors
{
    using System.Xml;

    using Creek.UI.EFML.UI_Elements;

    public class DropDownProcessor : ElementProcessor
    {
        #region Public Properties

        public override string Tagname
        {
            get
            {
                return "dropdown";
            }
        }

        #endregion

        #region Public Methods and Operators

        public override void Process(out UiElement ui, XmlNode t, Builder builder)
        {
            var r = new Dropdown();
            new ListEventProvider().Resolve(r, t);

            if (t.ChildNodes.Count > 0)
            {
                foreach (XmlNode child in t.ChildNodes)
                {
                    if (child.Name == "item")
                    {
                        r.Childs.Add(child.GetAttributeByName("value"));
                    }
                }
            }

            ui = r;
        }

        #endregion
    }
}